package com.enlorenz.core.channel.socket.common.writer;

import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

/**
 * 默认数据写出者
 * @author lcb
 */
public class DefaultNioWriter implements INioWriter{
	private SocketChannel channel;

	@Override
	public void write(byte[] data) throws Exception {
		channel.write(ByteBuffer.wrap(data));
		channel.socket().getOutputStream().flush();
	}
	@Override
	public void setSocketChannel(SocketChannel channel) {
		this.channel=channel;
	}

}
